<%extends'base.html'%>
<%block content%>
    <table id="table_blog" lay-filter="table_blog"></table><script type="text/html" id="csdn_info"><a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="blank">原始页面</a></script>
<%endblock%>
<%block script%>
  table.render({elem:'#table_blog',method:'post',skin:'row',even:true,url:'<< url_for('datalist') >>',page:{limit:20},cols:[[{field:'Id',title:'ID',width:80,sort:true,fixed:'left'},{field:'title',title:'标题',edit:true},{field:'nickName',title:'作者',edit:true},{field:'time',title:'发布时间',edit:true},{field:'tag',title:'标签',edit:true},{title:'操作',templet:'#csdn_info',fixed:'right'}]]});
   $('#list').addClass('layui-this');
  //监控table修改
  table.on('edit(table_blog)', function(obj){$.ajax({url:"<< url_for('editBlog') >>",method:'post',dataType:'json',data:{'Id':obj.data.Id,'field':obj.field,'value':obj.value},success:function(res){if(res.status==1){layer.msg('修改成功', {icon: 6});}else{layer.msg(res.msg, {icon: 5});}}});});
  //监控table工具条
 table.on('tool(table_blog)',function(obj){var layEvent=obj.event;if(layEvent==='blank'){var index=layer.open({type:2,title:'原始页面',content:obj.data.href,closeBtn:1,maxmin:!0});layer.full(index);}});
<%endblock%>